package com.ls.search;

/**
 * 线性查找
 */
public class SeqSearch {
    public static void main(String[] args) {
        int[] arr = {3, 7, 9, -1, 16, 1, -2, 10, 11};

        SeqSearch seqSearch = new SeqSearch();
        System.out.println(seqSearch.search(arr,7));
    }


    public int search(int[] arr,int value){
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == value){
                return i;
            }
        }
        return -1;

    }
}
